home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol E-12 / (Vol E-12) May 21 2012.iso / Animations / dj / dj.swf / scripts / __Packages / mx / controls / streamingmedia / FullScreenToggle.as < prev    next >
Text File  |  2012-05-21  |  6KB  |  189 lines

  1. class mx.controls.streamingmedia.FullScreenToggle extends MovieClip
  2. {
  3.    function FullScreenToggle()
  4.    {
  5.       super();
  6.       this.init();
  7.    }
  8.    function init()
  9.    {
  10.       this._player = this._parent._parent;
  11.       this._isFull = false;
  12.       this.setEnabled(this._player.__get__enabled());
  13.    }
  14.    function isFullScreen()
  15.    {
  16.       return this._isFull;
  17.    }
  18.    function displayFull(noAction)
  19.    {
  20.       this.gotoAndStop("big");
  21.       this._isFull = true;
  22.       if(!noAction)
  23.       {
  24.          this._originalPlayerX = this._player._x;
  25.          this._originalPlayerY = this._player._y;
  26.          this._originalPlayerWidth = this._player.width;
  27.          this._originalPlayerHeight = this._player.height;
  28.          this._originalAutosize = this._player.autoSize;
  29.          var _loc7_ = this._player.getController();
  30.          if(_loc7_.__get__controllerPolicy() == "auto" && _loc7_.__get__expanded())
  31.          {
  32.             mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayFull: about to call contract");
  33.             _loc7_.contract();
  34.          }
  35.          _loc7_.setNotAnimating(false);
  36.          this._player.__set__autoSize(false);
  37.          var _loc4_ = this.getContainerInfo();
  38.          this._player.setSize(_loc4_.width,_loc4_.height);
  39.          if(_loc4_.origin)
  40.          {
  41.             var _loc5_ = mx.managers.SystemManager.__get__screen();
  42.             mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayFull: scr=(" + _loc5_.x + "," + _loc5_.y + ")");
  43.             this._player._x = _loc5_.x;
  44.             this._player._y = _loc5_.y;
  45.          }
  46.          var _loc6_ = this._player.getBounds(_loc4_.container);
  47.          mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayFull: bounds=(" + _loc6_.xMin + "," + _loc6_.yMin + ")");
  48.          if(_loc4_.origin)
  49.          {
  50.             this._player._x += _loc5_.x;
  51.             this._player._y += _loc5_.y;
  52.          }
  53.          else
  54.          {
  55.             this._player._x += _loc4_.x;
  56.             this._player._y += _loc4_.y;
  57.          }
  58.          this._player._x -= _loc6_.xMin;
  59.          this._player._y -= _loc6_.yMin;
  60.          this._waited = false;
  61.          this.onEnterFrame = this.delayedBarRefresh;
  62.          var _loc3_ = this.getOtherToggles();
  63.          var _loc2_ = 0;
  64.          while(_loc2_ < _loc3_.length)
  65.          {
  66.             _loc3_[_loc2_].displayFull(true);
  67.             _loc2_ = _loc2_ + 1;
  68.          }
  69.       }
  70.    }
  71.    function getContainerInfo()
  72.    {
  73.       var _loc4_ = undefined;
  74.       var _loc6_ = this.getScrollViewAncestor(this._player);
  75.       if(_loc6_ == null)
  76.       {
  77.          var _loc5_ = mx.managers.SystemManager.__get__screen();
  78.          _loc4_ = {container:_root,width:_loc5_.width,height:_loc5_.height,x:0,y:0,origin:true};
  79.       }
  80.       else
  81.       {
  82.          var _loc3_ = _loc6_.getViewMetrics();
  83.          _loc4_ = {container:_loc6_,width:_loc6_.width - _loc3_.left - _loc3_.right,height:_loc6_.height - _loc3_.top - _loc3_.bottom,x:_loc3_.left,y:_loc3_.top,origin:false};
  84.       }
  85.       return _loc4_;
  86.    }
  87.    function getScrollViewAncestor(anMC)
  88.    {
  89.       var _loc3_ = undefined;
  90.       if(anMC == _root)
  91.       {
  92.          _loc3_ = null;
  93.       }
  94.       else if(anMC instanceof mx.core.ScrollView)
  95.       {
  96.          _loc3_ = anMC;
  97.       }
  98.       else
  99.       {
  100.          _loc3_ = this.getScrollViewAncestor(anMC._parent);
  101.       }
  102.       return _loc3_;
  103.    }
  104.    function delayedBarRefresh()
  105.    {
  106.       if(!this._waited)
  107.       {
  108.          this._waited = true;
  109.       }
  110.       else
  111.       {
  112.          delete this.onEnterFrame;
  113.          this._player.getController().refreshBars();
  114.       }
  115.    }
  116.    function displayNormal(noAction)
  117.    {
  118.       this.gotoAndStop("small");
  119.       this._isFull = false;
  120.       if(!noAction)
  121.       {
  122.          var _loc4_ = this._player.getController();
  123.          if(_loc4_.__get__controllerPolicy() == "auto" && _loc4_.__get__expanded())
  124.          {
  125.             mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.displayNormal: about to call contract");
  126.             _loc4_.contract();
  127.          }
  128.          _loc4_.setNotAnimating(false);
  129.          this._player.__set__autoSize(this._originalAutosize);
  130.          this._player.setSize(this._originalPlayerWidth,this._originalPlayerHeight);
  131.          this._player._x = this._originalPlayerX;
  132.          this._player._y = this._originalPlayerY;
  133.          this._waited = false;
  134.          this.onEnterFrame = this.delayedBarRefresh;
  135.          var _loc3_ = this.getOtherToggles();
  136.          var _loc2_ = 0;
  137.          while(_loc2_ < _loc3_.length)
  138.          {
  139.             _loc3_[_loc2_].displayNormal(true);
  140.             _loc2_ = _loc2_ + 1;
  141.          }
  142.       }
  143.    }
  144.    function toggleDisplay()
  145.    {
  146.       if(this._isFull)
  147.       {
  148.          this.displayNormal();
  149.       }
  150.       else
  151.       {
  152.          this.displayFull();
  153.       }
  154.    }
  155.    function getAllToggles()
  156.    {
  157.       return this._parent.getAllToggles();
  158.    }
  159.    function getOtherToggles()
  160.    {
  161.       var _loc3_ = this.getAllToggles();
  162.       var _loc2_ = 0;
  163.       while(_loc2_ < _loc3_.length)
  164.       {
  165.          if(_loc3_[_loc2_] == this)
  166.          {
  167.             _loc3_.splice(_loc2_,1);
  168.             break;
  169.          }
  170.          _loc2_ = _loc2_ + 1;
  171.       }
  172.       return _loc3_;
  173.    }
  174.    function getPlayer()
  175.    {
  176.       return this._player;
  177.    }
  178.    function getEnabled()
  179.    {
  180.       return this._player.__get__enabled();
  181.    }
  182.    function setEnabled(is)
  183.    {
  184.       mx.controls.streamingmedia.Tracer.trace("FullScreenToggle.setEnabled: " + is);
  185.       this._maximize.setEnabled(is);
  186.       this._minimize.setEnabled(is);
  187.    }
  188. }
  189.